package com.meixiang.entity.shopping;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

/**
 * 商品规格值
 *
 * @author LZRUI
 */
public class SpecTagValueEntity implements Parcelable {
    private String spValueId;  // 规格值类型
    private String spValueName; // 规格值名称
    private String exist; // 是否存在

    public SpecTagValueEntity() {
    }

    public SpecTagValueEntity(String spValueId, String spValueName, String exist) {
        this.spValueId = spValueId;
        this.spValueName = spValueName;
        this.exist = exist;
    }

    public String getSpValueId() {
        return spValueId == null ? "" : spValueId;
    }

    public void setSpValueId(String spValueId) {
        this.spValueId = spValueId;
    }

    public String getSpValueName() {
        return spValueName == null ? "" : spValueName;
    }

    public void setSpValueName(String spValueName) {
        this.spValueName = spValueName;
    }

    public String getExist() {
        return exist;
    }

    public void setExist(String exist) {
        this.exist = exist;
    }

    public boolean isExist() {
        if (!TextUtils.isEmpty(this.exist) && this.exist.equals("Y")) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.spValueId);
        dest.writeString(this.spValueName);
        dest.writeString(this.exist);
    }

    protected SpecTagValueEntity(Parcel in) {
        this.spValueId = in.readString();
        this.spValueName = in.readString();
        this.exist = in.readString();
    }

    public static final Creator<SpecTagValueEntity> CREATOR = new Creator<SpecTagValueEntity>() {
        @Override
        public SpecTagValueEntity createFromParcel(Parcel source) {
            return new SpecTagValueEntity(source);
        }

        @Override
        public SpecTagValueEntity[] newArray(int size) {
            return new SpecTagValueEntity[size];
        }
    };
}
